﻿@page "/editors"
@inject SwalService SwalService
@inject VersionService VersionManager
@inject IStringLocalizer<Editors> Localizer

<h3>@Localizer["Title"]</h3>

<h4>@((MarkupString)Localizer["H1"].Value)</h4>

<p>@((MarkupString)Localizer["P1"].Value)</p>

<div class="code-label">.NET CLI</div>
<Pre class="no-highlight">dotnet add package BootstrapBlazor.SummerNote --version @Version</Pre>

<div class="code-label">PackageReference</div>
<Pre class="no-highlight">&lt;PackageReference Include="BootstrapBlazor.SummerNote" Version="@Version" /&gt;</Pre>

<div class="code-label">Package Manager</div>
<Pre class="no-highlight">Install-Package BootstrapBlazor.SummerNote -Version @Version</Pre>

<DemoBlock Title="@Localizer["Block1Title"]" Introduction="@Localizer["Block1Intro"]" Name="Normal">
    <p>@((MarkupString)Localizer["P2"].Value)</p>
    <div class="form-control mb-3">@((MarkupString)Localizer["Div1"].Value)</div>
    <Editor></Editor>
</DemoBlock>

<DemoBlock Title="@Localizer["Block2Title"]" Introduction="@Localizer["Block2Intro"]" Name="Placeholder">
    <p>@((MarkupString)Localizer["P3"].Value)</p>
    <Editor PlaceHolder="@Localizer["Placeholder1"]"></Editor>
</DemoBlock>

<DemoBlock Title="@Localizer["Block3Title"]" Introduction="@Localizer["Block3Intro"]" Name="IsEditor">
    <Editor IsEditor="true"></Editor>
</DemoBlock>

<DemoBlock Title="@Localizer["Block4Title"]" Introduction="@Localizer["Block4Intro"]" Name="Height">
    <Editor IsEditor="true" Height="400"></Editor>
</DemoBlock>

<DemoBlock Title="@Localizer["Block5Title"]" Introduction="@Localizer["Block5Intro"]" Name="OnValueChanged">
    <p>@((MarkupString)Localizer["P4"].Value)</p>
    <Editor @bind-Value="@EditorValue" OnValueChanged="@OnValueChanged"></Editor>

    <label class="form-label mt-3">@Localizer["Label1"]</label>
    <textarea class="form-control mt-3">@EditorValue</textarea>
    <div class="mt-3">
        <Button OnClick="SetValue">Reset</Button>
    </div>
</DemoBlock>

<DemoBlock Title="@Localizer["Block6Title"]" Introduction="@Localizer["Block6Intro"]" Name="CustomerToolbarButtons">
    <p>@((MarkupString)Localizer["P5"].Value)</p>
    <Editor IsEditor="true" OnClickButton="@PluginClick" CustomerToolbarButtons="@EditorPluginItems"></Editor>
</DemoBlock>

<DemoBlock Title="@Localizer["Block7Title"]" Introduction="@Localizer["Block7Intro"]" Name="ToolbarItems">
    <p>@((MarkupString)Localizer["P6"].Value)</p>
    <Editor IsEditor="true" ToolbarItems="@ToolbarItems"></Editor>
</DemoBlock>

<DemoBlock Title="@Localizer["DoMethodAsync"]" Introduction="@Localizer["DoMethodAsyncIntro"]" Name="DoMethodAsync">
    <p>@((MarkupString)Localizer["P6"].Value)</p>
    <Editor IsEditor="true" @ref="Editor"></Editor>
    <div class="mt-3">
        <Button OnClick="InsertHtmlAsync">@Localizer["DoMethodAsyncButton1"]</Button>
        <Button OnClick="@(() => Editor.DoMethodAysnc("formatH2", ""))">@Localizer["DoMethodAsyncButton2"]</Button>
        <Button OnClick="@(() => Editor.DoMethodAysnc("insertImage", "https://www.blazor.zone/_content/BootstrapBlazor.Shared/images/avatars/150-1.jpg", "tree"))">@Localizer["DoMethodAsyncButton3"]</Button>
    </div>
</DemoBlock>

<AttributeTable Items="@GetAttributes()" />
